export function lineBarChartFun(data) {
	let seriesData = (data.yData || []).map((item, index) => {
		if (item.type == 'line') {
			return {
				name: item.name || '',
				type: 'line',
				symbolSize: 6,
				symbol: 'circle',
				smooth: true,
				data: item.value || [],
				itemStyle: {
					color: item.color,
				},
				yAxisIndex: 1,
			};
		} else {
			return {
				name: item.name || '',
				type: 'bar',
				barWidth:'16px',
				itemStyle: {
					color: item.color
				},
				data: item.value || [],
			}
		}

	});
	let lineAreaChartsOption = {
		tooltip: {
			trigger: "axis",
		},
		grid: {
			left: '3.5%',
			right: '3.5%',
			bottom: '3.5%',
			top: '18%',
			containLabel: true,
		},
		//图例
		legend: {
			show: data.legendShow === false ? data.legendShow : true,
			// left: data.legendLeft ? data.legendLeft : '10%',
			left: 'center',
			top: '4%',
			textStyle: {
				fontSize: 12,
				color: "#C9DFFF",
			},
			itemWidth: 16,
			itemHeight: 10,
			itemGap: 20,
		},
		xAxis: {
			type: 'category',
			data: data.xData,
			axisLine: {
				show: true,
				lineStyle: {
					color: '#304C7E',
					width: 1,
				},
			},
			axisTick: {
				show: false,
			},
			axisLabel: {
				show: true,
				textStyle: {
					color: '#C9DFFF', //X轴文字颜色
					fontSize: 12
				},
			},
		},

		yAxis: [{
				type: "value",
				// name: "个",
				splitLine: {
					show: true,
					lineStyle: {
						color: "#304c7e5c",
						dashOffset: 2,
					},
				},
				axisLabel: {
					padding: [0, 5, 0, 0],
					fontSize: 12,
					textStyle: {
						color: "#C9DFFF",
						fontFamily: "Microsoft YaHei",
					},
				},
			},
			{
				// name: "(%)",
				type: "value",
				splitLine: {
					show: false,
				},
				axisLabel: {
					formatter: "{value}",
					textStyle: {
						color: "#C9DFFF",
						fontFamily: "Microsoft YaHei",
					},
				},
			}
		],
		series: seriesData,
	};
	
	return lineAreaChartsOption
}